﻿using CNKI.TPI.Web.Base;
using CNKI.TPI.Web.Interface.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;

namespace CNKI.TPI.Web.Interface.Areas.User.Controllers
{
    public class LoginExtController : BaseApiController
    {
        // POST api/loginext
        public object Post()
        {
            OutputEntity result = new OutputEntity();
            try
            {
                HttpContextBase context = (HttpContextBase)Request.Properties["MS_HttpContext"];//获取传统context     
                HttpRequestBase request = context.Request;//定义传统request对象
                string userid = request.Form["userid"];
                string usercode = request.Form["usercode"];
                result.data = SessionManager.Login(userid, usercode);
                result.Status = Status.Success;
            }
            catch (Exception ex)
            {
                LogOpr.Error(ex.ToString());
                result.Status = Status.Error;
                result.message = ex.Message;
            }
            return result;
        }
    }
}
